home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gsio.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.5 KB  |  79 lines

  1. /* Copyright (C) 1989, 1990, 1993, 1996, 1999, 2000 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gsio.h,v 1.4 2000/09/19 19:00:29 lpd Exp $ */
  20. /* stdio redirection */
  21.  
  22. #ifndef gsio_INCLUDED
  23. #  define gsio_INCLUDED
  24.  
  25. /*
  26.  * Define substitutes for stdin/out/err.  Eventually these will always be
  27.  * referenced through an instance structure.
  28.  */
  29. extern FILE *gs_stdio[3];
  30. #define gs_stdin (gs_stdio[0])
  31. #define gs_stdout (gs_stdio[1])
  32. #define gs_stderr (gs_stdio[2])
  33.  
  34. /*
  35.  * The library and interpreter must never use stdin/out/err directly.
  36.  * Make references to them illegal.
  37.  */
  38. #undef stdin
  39. #define stdin stdin_not_available
  40. #undef stdout
  41. #define stdout stdout_not_available
  42. #undef stderr
  43. #define stderr stderr_not_available
  44. /* However, for the moment, lprintf must be able to reference stderr. */
  45. #undef dstderr
  46. #define dstderr gs_stderr
  47. #undef estderr
  48. #define estderr gs_stderr
  49.  
  50. /*
  51.  * Redefine all the relevant stdio functions to reference stdin/out/err
  52.  * explicitly, or to be illegal.
  53.  */
  54. #undef fgetchar
  55. #define fgetchar() fgetc(stdin)
  56. #undef fputchar
  57. #define fputchar(c) fputc(c, stdout)
  58. #undef getchar
  59. #define getchar() getc(stdin)
  60. #undef gets
  61. #define gets Function._gets_.unavailable
  62. /* We should do something about perror, but since many Unix systems */
  63. /* don't provide the strerror function, we can't.  (No Aladdin-maintained */
  64. /* code uses perror.) */
  65. #undef printf
  66. #define printf Function._printf_.unavailable
  67. #undef putchar
  68. #define putchar(c) fputc(c, stdout)
  69. #undef puts
  70. #define puts(s) (fputs(s, stdout), putchar('\n'))
  71. #undef scanf
  72. #define scanf Function._scanf_.unavailable
  73. #undef vprintf
  74. #define vprintf Function._vprintf_.unavailable
  75. #undef vscanf
  76. #define vscanf Function._vscanf_.unavailable
  77.  
  78. #endif /* gsio_INCLUDED */
  79.